#include "RLSNeuron.h"

CRLSNeuron::CRLSNeuron(int inputDimension) :
	m_Weight(inputDimension),
	m_LastWeight(inputDimension),
	m_LastPMatrix(Matrix::BuildIdentity(inputDimension))
{
	for (int i = 0; i < this->m_LastWeight.GetDimesion(); i++)
	{
		this->m_LastWeight[i] = 0.0;
	}
}

void CRLSNeuron::SetWeight(const Vector & weight)
{
	this->m_LastWeight = this->m_Weight;

	this->m_Weight = weight;
}

Vector CRLSNeuron::GetWeight()
{
	return this->m_Weight;
}

Vector CRLSNeuron::GetLastWeight()
{
	return this->m_LastWeight;
}

void CRLSNeuron::SetLastPMatrix(const Matrix & P)
{
	this->m_LastPMatrix = P;
}

Matrix CRLSNeuron::GetLastPMatrix()
{
	return this->m_LastPMatrix;
}

double CRLSNeuron::Execute(const Vector & inputData)
{
	return this->m_Weight.Dot(inputData);
}